/*
 *  Copyright 2009 Utkin Dmitry
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
 
/* 
 *  This file is part of the WSF Staff project.
 *  Please, visit http://code.google.com/p/staff for more information.
 */

// This file generated by staff_codegen
// Client skeleton

#include <stdio.h>
#include <iostream>
#include <rise/threading/SharedPtr.h>
#include <rise/string/String.h>
#include <rise/common/Log.h>
#include <rise/common/ExceptionTemplate.h>
#include <rise/common/console.h>
#include <staff/common/Exception.h>
#include "ServiceFactory.h"
#foreach $(Project.Interfaces)
#include "$(Interface.Name).h"
#end

int main(int nArgs, const char* paszArgs[])
{
#foreach $(Project.Interfaces)
  try
  {
#foreach $(Interface.Classes)
    {
      rise::CSharedPtr< $(Class.NsName) > p$(Class.ServiceName) = 
        CServiceFactory::Inst().GetService< $(Class.NsName) >();

      RISE_ASSERTES(p$(Class.ServiceName) != NULL, rise::CLogicNoItemException, "Cannot get client for service $(Class.ServiceNsName)!");

      // Invoke Your service here:
#foreach $(Class.Members)
      // \
#ifneq($(Member.Return.Name),void)
$(Member.Return.Name) $(Member.Return.NodeName) = \
#else
\
#ifeqend
p$(Class.ServiceName)->$(Member.Name)(\
#foreach $(Member.Params)
#ifeq($(Param.$Num),0)
\
#else
, \
#ifeqend
$(Param.Name)\
#end
);
#end
    }
#end
  }
  catch(const staff::CRemoteException& rEx)
  {
    rise::LogError() << rEx.GetDescr();
  }
  RISE_CATCH_ALL
  
#end
  return 0;
}
